package com.example.helloworld;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

public class MoveImage extends Activity {
	private TextView text1;
	private TextView text2;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_move_image);
		
		text1 =	(TextView)findViewById(R.id.textView1);
		text2 =	(TextView)findViewById(R.id.textView2);
	}

		private String getLog(float x, float y) {
			String log =	String.format(
					"x,y=[%f]x[%f]", 
					x, y);
			
			return log;
		}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
		case MotionEvent.ACTION_MOVE:
			text1.setText(getLog(event.getX(), event.getY()));
		}
		
		return super.onTouchEvent(event);
	}
	
}
